$(function(){
	var uName = $.cookie("youleche.u");
	if(uName != null){
		$("#divLogin").html('');
		$("#divLogin").html("<span style=\"color:#666;font-size:12px;\">欢迎你，</span><a  onclick=\"myMeile();\" style=\"cursor:pointer;color:#3CAC7E;font-size:16px;\">" +uName +"</a>&nbsp;&nbsp;<span style=\"color:#ccc;font-size:12px;\">|</span>&nbsp;&nbsp;<a  onclick=\"myMeile();\" style=\"cursor:pointer;color:#666;font-size:12px;\">我的美乐车</a>");
	}
	
	AreaSelector().init();
	shangmenFuwuCheckBtnLiveEvent();
	yingyeTimeCheckBtnLiveEvent();
	dianpuValidate();
	linkManValidate();
	phoneNumValidate();
	addressValidate();
	validateInfoTitle();
	validateDesc();
	validateUserAndPass();
});
function validateUserAndPass(){
	$("#email").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请输入用户名/邮箱/手机号其中一种";
		$("#tipUser").html(warnHmtl);
		$("#tipUser").css("color", "#1c86ee");
		$("#email").css("border", "#ccc 1px solid");
	});
	
	
	$("#email").live("focusout", function(){
		var email = $("#email").val();
		if(email == ""){
			$("#email").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>用户名/邮箱/手机号不能为空";
			$("#tipUser").html(warnHmtl);
			$("#tipUser").css("color", "#f60");
		}else{
			$("#email").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tipUser").html(warnHtmlOk);
		}
	});
	
	$("#password").live("focusout", function(){
		var email = $("#password").val();
		if(email == ""){
			$("#password").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>密码不能为空";
			$("#tipPass").html(warnHmtl);
			$("#tipPass").css("color", "#f60");
		}else{
			$("#password").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
			$("#tipPass").html(warnHtmlOk);
		}
	});
	
	$("#password").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请输入密码";
		$("#tipPass").html(warnHmtl);
		$("#tipPass").css("color", "#1c86ee");
		$("#password").css("border", "#ccc 1px solid");
	});
}

function validateDesc(){
	$("#fixDescrible").live("focusin",function(){
		$("#fixDescrible").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>售后描述尽量详细";
		$("#tipfixDescrible").html(warnHmtl);
		$("#tipfixDescrible").css("color", "#1c86ee");
	});
	
	$("#fixDescrible").live("focusout",function(){
		var maxSpeed = $("#fixDescrible").val();
		if(maxSpeed == ""){
			$("#fixDescrible").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>售后描述不能为空";
			$("#tipfixDescrible").html(warnHmtl);
			$("#tipfixDescrible").css("color", "#f60");
		}else{
			$("#fixDescrible").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipfixDescrible").html(warnHtmlOk);
		}
	});
}
function addressValidate(){
	$("#sel_Province").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>请输入详细地址";
		$("#tippinpai").html(warnHmtl);
		$("#tippinpai").css("color", "#1c86ee");
		$("#txt_pinpai").css("border", "#ccc 1px solid");
	});
	
	$("#sel_Province").live("focusout", function(){
		var provinceValue = $("#sel_Province option:selected").text();
		if(provinceValue == "--省份--"){
			$("#sel_Province").css("border", "1px solid #f60");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
			$("#tipaddressAttach").html(warnHmtl);
			$("#tipaddressAttach").css("color", "#f60");
			
		}else{
			$("#sel_Province").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipaddressAttach").html(warnHtmlOk);
		}
	});
	
	$("#sel_City").live("focusout", function(){
		$("#tipaddressAttach").empty();
		var provinceValue = $("#sel_City option:selected").text();
		if(provinceValue == "--城市--"){
			$("#sel_City").css("border", "1px solid #f60");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择城市";
			$("#tipaddressAttach").html(warnHmtl);
			$("#tipaddressAttach").css("color", "#f60");
			
		}else{
			$("#sel_City").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipaddressAttach").html(warnHtmlOk);
		}
	});
	
	$("#addressAttach").live("focusin", function(){
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>地址尽量详细";
		$("#tipaddressAttach").html(warnHmtl);
		$("#tipaddressAttach").css("color", "#1c86ee");
		$("#addressAttach").css("border", "#1c86ee 1px solid");
		var province = $("#sel_Province option:selected").text();
		if(province == "--省份--"){
			$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
		}
		
		var city = $("#sel_City option:selected").text();
		if(city == "--城市--"){
			$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
		}	
	});
	
	$("#addressAttach").live("focusout", function(){
		if($("#addressAttach").val() == ""){
			$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请输入详细地址";
			$("#tipaddressAttach").html(warnHmtl);
			$("#tipaddressAttach").css("color", "#f60");
			return;
		}
		var province = $("#sel_Province option:selected").text();
		if(province == "--省份--"){
			$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
			$("#tipaddressAttach").html(warnHmtl);
			$("#tipaddressAttach").css("color", "#f60");
			return;
		}
		
		var city = $("#sel_City option:selected").text();
		if(city == "--城市--"){
			$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择城市";
			$("#tipaddressAttach").html(warnHmtl);
			$("#tipaddressAttach").css("color", "#f60");
			return;
		}else{
			$("#addressAttach").css("border", "#ccc 1px solid");
			$("#sel_Province").css("border", "#ccc 1px solid");
			$("#sel_City").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipaddressAttach").html(warnHtmlOk);
		}
	});
}

function validateInfoTitle(){
	$("#infoTitle").live("focusin",function(){
		$("#infoTitle").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>信息标题的长度不能超过100个汉字";
		$("#tipinfoTitle").html(warnHmtl);
		$("#tipinfoTitle").css("color", "#1c86ee");
	});
	
	$("#infoTitle").live("focusout",function(){
		var maxSpeed = $("#infoTitle").val();
		if(maxSpeed == ""){
			$("#infoTitle").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请输入信息标题(不能超过100个汉字)";
			$("#tipinfoTitle").html(warnHmtl);
			$("#tipinfoTitle").css("color", "#f60");
		}else if(maxSpeed.length > 100){
			$("#infoTitle").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>信息标题不能超过100个汉字";
			$("#tipinfoTitle").html(warnHmtl);
			$("#tipinfoTitle").css("color", "#f60");
		}else{
			$("#infoTitle").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tipinfoTitle").html(warnHtmlOk);
		}
	});
}
function phoneNumValidate(){
	$("#txtlinkPhoneNum").live("focusin",function(){
		$("#txtlinkPhoneNum").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>联系电话是11位（座机请加上区号）";
		$("#tiplinkPhoneNum").html(warnHmtl);
		$("#tiplinkPhoneNum").css("color", "#1c86ee");
	});
	
	$("#txtlinkPhoneNum").live("focusout",function(){
		var maxSpeed = $("#txtlinkPhoneNum").val();
		if(maxSpeed == ""){
			$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话不能为空";
			$("#tiplinkPhoneNum").html(warnHmtl);
			$("#tiplinkPhoneNum").css("color", "#f60");
		}else if(maxSpeed.length != 11){
			$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话是11位（座机请加上区号）";
			$("#tiplinkPhoneNum").html(warnHmtl);
			$("#tiplinkPhoneNum").css("color", "#f60");
		}else{
			$("#txtlinkPhoneNum").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tiplinkPhoneNum").html(warnHtmlOk);
		}
	});
}

function linkManValidate(){
	$("#txtlinkMan").live("focusin",function(){
		$("#txtlinkMan").css("border", "#ccc 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/warn_icon.jpg\"/>联系人尽量填写真实姓+先生/小姐(eg:张先生、张小姐)";
		$("#tiplinkMan").html(warnHmtl);
		$("#tiplinkMan").css("color", "#1c86ee");
	});
	
	$("#txtlinkMan").live("focusout",function(){
		var maxSpeed = $("#txtlinkMan").val();
		if(maxSpeed == ""){
			$("#txtlinkMan").css("border", "rgb(255, 153, 0) 1px solid");
			var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系人不能为空";
			$("#tiplinkMan").html(warnHmtl);
			$("#tiplinkMan").css("color", "#f60");
		}else{
			$("#txtlinkMan").css("border", "#ccc 1px solid");
			var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
			$("#tiplinkMan").html(warnHtmlOk);
		}
	});
	
}

function dianpuValidate(){
	$("#txt_Dianpu").live("focusin",function(){
		$("#divWarnDianpu").empty();
		$("#divWarnDianpu").css("display", "none");
		$("#txt_Dianpu").css("border", "1px solid #ccc");
		var warnHmtl = "<img src=\"image/warn_icon.jpg\"/>店铺名称需填写真实店铺名称";
		$("#divWarnDianpu").html(warnHmtl);
		$("#divWarnDianpu").css("display", "block").css("color", "#1C86EE");
	});
	
	$("#txt_Dianpu").live("focusout",function(){
		if($("#txt_Dianpu").val() == ""){
			var warnHtml = "<img src=\"image/verror.png\"/>忘记输入店铺名称了~~~";
			$("#divWarnDianpu").empty();
			$("#txt_Dianpu").css("border", "1px solid #f60");
			$("#divWarnDianpu").html(warnHtml);
			$("#divWarnDianpu").css("display", "block").css("color", "#f60");
		}else{
			$("#divWarnDianpu").empty();
			if($("#txt_Dianpu").val().length > 25){
				var warnHtml = "<img src=\"image/verror.png\"/>店铺名称的长度尽量在20个汉字以内~~~";
				$("#divWarnDianpu").empty();
				$("#txt_Dianpu").css("border", "1px solid #f60");
				$("#divWarnDianpu").html(warnHtml);
				$("#divWarnDianpu").css("display", "block").css("color", "#f60");
			}else{				
				var warnHtmlOk = "<img src=\"image/good_icon.png\"/>";
				$("#divWarnDianpu").html(warnHtmlOk);
				$("#divWarnDianpu").css("display", "block");				
			}
		}
	});
}
function yingyeTimeCheckBtnLiveEvent(){
	$("#chk0").live("change",function(){
		if($("#chk0").attr("checked") == "checked"){
			for(var i=1;i<8;i++){
				$("#chk"+i).attr("checked", "checked");
			}
		}else{
			for(var i=1;i<8;i++){
				$("#chk"+i).removeAttr("checked");
			}
		}
		
	});
	
	$("#chk1").live("change",function(){
		if($("#chk1").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk2").live("change",function(){
		if($("#chk2").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk3").live("change",function(){
		if($("#chk3").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk4").live("change",function(){
		if($("#chk4").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk5").live("change",function(){
		if($("#chk5").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk6").live("change",function(){
		if($("#chk6").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
	$("#chk7").live("change",function(){
		if($("#chk7").attr("checked") != "checked"){
			$("#chk0").removeAttr("checked");
		}else{
			var result = "0";
			for(var n=1;n<8;n++){
				if($("#chk"+n).attr("checked") != "checked"){
					result = "1";
					break;
				}
			}
			
			if(result == "0"){
				$("#chk0").attr("checked", "checked");
			}
		}
	});
}

function shangmenFuwuCheckBtnLiveEvent(){
	$("#chk1fw").live("change",function(){
		if($("#chk1fw").attr("checked") == "checked"){
			$("#chk0fw").removeAttr("checked");
		}else{
			$("#chk0fw").attr("checked", "checked");
		}
		
	});
	
	$("#chk0fw").live("change",function(){
		if($("#chk0fw").attr("checked") == "checked"){
			$("#chk1fw").removeAttr("checked");
		}else{
			$("#chk1fw").attr("checked", "checked");
		}
		
	});
}
function myMeile(){
	var u = $.cookie("youleche.u");
	if(u == null){
		window.location.href = "login.jsp";
	}else{
		$.ajax({
			type : 'post',
			dataType : 'text',
			contentType : "application/json",
    		url: "login.do",
    		success: function(v){
    			if(v == "true"){
    				window.location.href = "user/index.jsp";
    			}else{
    				window.location.href = "login.jsp";
    			}
    		}
		});
	}
}

function releaseOther(){
	window.location.href="list.jsp";
}

function teachMe(){
	var title = "成都修理自行车、电动车";
	if($("#chk0fw").attr("checked") == "checked"){
		title += ",每天8:00-20:00提供上门服务";
	}
	
	if($("#txtlinkPhoneNum").val() != ""){
		title += ",联系电话 " +$("#txtlinkPhoneNum").val() ;
	}
	
	$("#infoTitle").val(title);
	
	var fixType = "";
	if($("#chk0fw").attr("checked") == "checked"){
		fixType = "上门服务";
	}else{
		fixType = "店铺修理";
	}
	
	var content = "修理方式："+fixType+"\n";
	content += "修理机械：电动车、自行车\n";
	content += "修理描述：";
	
	$("#fixDescrible").val(content);
	
	$("#infoTitle").css("border", "#ccc 1px solid");
	var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
	$("#tipinfoTitle").html(warnHtmlOk);
	
	$("#fixDescrible").css("border", "#ccc 1px solid");
	var warnHtmlOk = "<img src=\"" +ctx +"/image/good_icon.png\"/>";
	$("#tipfixDescrible").html(warnHtmlOk);
	
	
}

function validateInput(){
	var shopName = $("#txt_Dianpu").val();
	if(shopName == ""){
		$("#divWarnDianpu").css("display", "block");
		if($("#txt_Dianpu").val() == ""){
			var warnHtml = "<img src=\"image/verror.png\"/>忘记输入店铺名称了~~~";
			$("#divWarnDianpu").empty();
			$("#txt_Dianpu").css("border", "1px solid #f60");
			$("#divWarnDianpu").html(warnHtml);
			$("#divWarnDianpu").css("display", "block").css("color", "#f60");
		}
		return false;
	}
	
	if(shopName.length > 25){
		$("#divWarnDianpu").css("display", "block");
		if($("#txt_Dianpu").val() == ""){
			var warnHtml = "<img src=\"image/verror.png\"/>店铺名称长度应在20个汉字以内~~~";
			$("#divWarnDianpu").empty();
			$("#txt_Dianpu").css("border", "1px solid #f60");
			$("#divWarnDianpu").html(warnHtml);
			$("#divWarnDianpu").css("display", "block").css("color", "#f60");
		}
		return false;
	}
	
	var province = $("#sel_Province option:selected").text();
	if(province == "--省份--"){
		$("#sel_Province").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择省份";
		$("#tipaddressAttach").html(warnHmtl);
		return false;
	}
	
	var city = $("#sel_City option:selected").text();
	if(city == "--城市--"){
		$("#sel_City").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请选择车城市";
		$("#tipaddressAttach").html(warnHmtl);
		return false;
	}		
		
	var attachAddr = $('#addressAttach').val();
	if(attachAddr == ""){
		$("#addressAttach").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>请输入详细地址";
		$("#tipaddressAttach").html(warnHmtl);
		return false;
	}
	
	var fixTime = "1234567";
	var linkMan = $("#txtlinkMan").val();
	if(linkMan == ""){
		$("#txtlinkMan").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系人不能为空";
		$("#tiplinkMan").html(warnHmtl);
		$("#tiplinkMan").css("color", "#f60");
		return;
	}
	var phoneNum = $("#txtlinkPhoneNum").val();
	if(phoneNum == ""){
		$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话不能为空";
		$("#tiplinkPhoneNum").html(warnHmtl);
		$("#tiplinkPhoneNum").css("color", "#f60");
		return false;
	}
	
	if(phoneNum.length != 11){
		$("#txtlinkPhoneNum").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>联系电话是11位";
		$("#tiplinkPhoneNum").html(warnHmtl);
		$("#tiplinkPhoneNum").css("color", "#f60");
		return false;
	}
	
	var fixTitle = $("#infoTitle").val();
	if(fixTitle == ""){
		$("#infoTitle").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>信息标题为空";
		$("#tipinfoTitle").html(warnHmtl);
		$("#tipinfoTitle").css("color", "#f60");
		return false;
	}
	var fixContent = $("#fixDescrible").val();
	if(fixContent == ""){
		$("#fixDescrible").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>售后描述不能为空";
		$("#tipfixDescrible").html(warnHmtl);
		$("#tipfixDescrible").css("color", "#f60");
		return;
	}
	
	return true;
}

function confirmAndSubmit() {
	
	if(validateInput()){
		$.ajax({
			type : 'post',
			dataType : 'text',
			contentType : "application/json",
    		url: "login.do",
    		success: function(v){
    			if(v == "true"){
    				var u = $.cookie("youleche.u");
    				$.ajax({
    					type : 'get',
    					dataType : 'text',
    					contentType : "application/json",
    		    		url: "u.do?type=11&userName="+u,
    		    		success: function(v){
    	    				submitMessage(v);
    	    				
    	    			}
    				});
    			}else{
    				showSecondStep();
    			}
    		}
    	}); 
	}	
}

function showSecondStep(){
	$(".step1_img img").attr("src", "image/next_b.png");
	$(".step2_img img").attr("src", "image/next.png");
	$("#div_info").css("display", "none");
	$("#div_email").css("display", "block"); 
}

function showThirdStep(){
	$(".step1_img img").attr("src", "image/next_b.png");
	$(".step2_img img").attr("src", "image/next_b.png");
	$(".step3_img img").attr("src", "image/success.png");
	$(".step3_img img").attr("src", "image/next.png");
	$(".step3_img1 img").attr("src", "image/success.png");
	$(".step3_img1 img").css("display", "block");
	$("#div_email").css("display", "none");
	$("#div_info").hide();
	$("#div_success").css("display", "block"); 
}

//提交信息事件
function commerSubmit() {
	var userName = $("#email").val();
	var password = $("#password").val();
	if(userName == ""){
		$("#email").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>用户名/邮箱/手机号不能为空";
		$("#tipUser").html(warnHmtl);
		$("#tipUser").css("color", "#f60");
		return;
	}
	
	if(password == ""){
		$("#password").css("border", "rgb(255, 153, 0) 1px solid");
		var warnHmtl = "<img src=\"" +ctx +"/image/verror.png\"/>密码不能为空";
		$("#tipPass").html(warnHmtl);
		$("#tipPass").css("color", "#f60");
		return;
	}
	//发登陆请求
	$.ajax({
		type: "post",
		dataType: "text",
		url: "u.do?type=10&userName="+userName+"&password="+password,
		success: function(v){
			if(v != ""){
				submitMessage(v);
			}else{
				layer.alert("亲美美，用户名或者密码有误~~~", 2);
			}
		}
	}); 
}

//提交信息到服务器方法,保存成功返回true,否则返回false
function submitMessage(sellerId) {
	
	var fixInfo = getFixInfo(sellerId);
	if(fixInfo != ""){
		showThirdStep();
	}
}

function getFixInfo(sellerId){
	var shopName = $("#txt_Dianpu").val();
	if(shopName == ""){
		return "";
	}
	
	var province = $("#sel_Province option:selected").text();
	if(province == "--省份--"){
		return "";
	}
	
	var city = $("#sel_City option:selected").text();
	if(city == "--城市--"){
		return "";
	}
	
	var area = $("#sel_County option:selected").text();
	if(area == "--区域--"){
		return "";
	}
	
	var address = $("#addressAttach").val();
	if(address == ""){
		return "";
	}
	
	var A1 =province + city + area + address;
	
	var isGoHome = "0";
	
	if($("#chk0fw").attr("checked") == "checked"){
		isGoHome = "0";
	}else{
		isGoHome = "1";
	}
	
	var fixTime = "";
	
	if($("#chk0").attr("checked") == "checked"){
		fixTime = "0";
	}else{
		for(var i =1; i<8;i++){
			if($("#chk"+i).attr("checked") == "checked"){
				fixTime += i;
			}
		}
	}
	
	var linkMan = $("#txtlinkMan").val();
	if(linkMan == ""){
		return "";
	}
	var phoneNum = $("#txtlinkPhoneNum").val();
	if(phoneNum == ""){
		return "";
	}
	
	var fixTitle = $("#infoTitle").val();
	if(fixTitle == ""){
		return "";
	}
	var fixContent = $("#fixDescrible").val();
	if(fixTitle == ""){
		return "";
	}

	var fixInfo = new Object();
	fixInfo.shopName = shopName;
	fixInfo.A1 = A1;
	fixInfo.fixTime = fixTime;
	fixInfo.isGoHome = isGoHome;
	fixInfo.linkMan = linkMan;
	fixInfo.phoneNum = phoneNum;
	fixInfo.fixTitle = fixTitle;
	fixInfo.fixContent = fixContent;
	fixInfo.sellerId = sellerId;
	var jsonFix = JSON.stringify(fixInfo);
	//发送数据
	$.ajax({
		type: "post",
		dataType: "text",
		data: jsonFix,
		contentType: "application/json",
		url: "sfix.do?action=0",
		success: function(v){
			if(v == "1"){
				showThirdStep();
			}else{
			}
		}
	}); 
}

function returnHome(){
	window.location.href="home.jsp";
}

function returnFix(){
	window.location.href="fixs.jsp";
	
}

function prefixStep(){
	$("#div_email").hide();
	$("#div_info").show();
	$(".step1_img img").attr("src", "image/next.png");
	$(".step2_img img").attr("src", "image/next_b.png");
}